#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
	int n = 0, j = 0, k = 0;
	scanf("%d", &n);
	int arr[10];
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &arr[i]);
	}
	int t = arr[0];
	for (j = 0; j < n; j++)
	{
		if (t <= arr[j])
		{
			t = arr[j];
		}
	}
	for (k = 0; k < n; k++)
	{
		if (arr[k] == t)
			break;
	}
	printf("%d %d", t, k);

	return 0;
}
